home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Bombardier_PC / BSCRIPTS.CST / 00094_Script_category < prev    next >
Text File  |  1999-04-25  |  6KB  |  219 lines

  1. -- ⌐ 1998 @radical.media, inc. & Concurrent New Media Group, L.L.C.
  2. -- Developed for Bombardier, Inc.
  3. --
  4. -- All programming developed by: 
  5. -- Robert Fabricant, Valerie Valoueva, Ossi Shaked, 
  6. -- Henry Sauvageot, Chris Howell & Chris Girand
  7. --
  8. -- Use of this code by parties other than @radical.media, inc. or their
  9. --agents 
  10. -- without the express written consent of @radical.media, inc. AND Concurrent 
  11. -- New Media Group, L.L.C. is strictly prohibited.
  12. ------------------------------------------------------
  13.  
  14. property mySprite, myNormal, myRoller, myHilite, selected, myName, myFrame, myType, myGroup, lastSelected,catEnabled
  15. global lastSub
  16.  
  17. on new me
  18.   global menuController
  19.   
  20.   set mySprite = the spritenum of me
  21.   set myNormal = the member of sprite mySprite
  22.   set myName = the name of member the member of sprite mySprite
  23.   set hilName = myName&"-hil"
  24.   set rollName = myName&"-roll"
  25.   set myRoller = member rollName
  26.   set myHilite = member hilName
  27.   set selected = 0
  28.   set catEnabled = 0--This property controls the following functionality:
  29.                     --lets you to jump to category section by clicking
  30.                     --on a categoty while in a subcategory section 
  31.                     --and a subcategory menu is open
  32.   set scriptNum = the scriptNum of sprite mySprite
  33.   set myType = the name of member scriptNum
  34.   register menuController, me, myName
  35.   puppetSprite mySprite, true
  36.   return me
  37.   
  38. end
  39.  
  40.  
  41. on setFrame me, theFrame
  42.   set myFrame = theFrame
  43. end
  44.  
  45. on heresYourGroup me, theGroup
  46.   set myGroup = theGroup
  47. end
  48.  
  49. on setLastSelected me, theLastSelObj
  50.   set lastSelected = theLastSelObj
  51. end
  52.  
  53. on getType me
  54.   return myType
  55. end
  56.  
  57.  
  58. -- the 2 rollover handlers
  59. on mouseEnter me
  60.   if not selected then
  61.     puppetsound 3, "subrollOldOld"
  62.     set the member of sprite mySprite = member myRoller
  63.   else
  64.     repeat with i = 1 to count(myGroup)
  65.       set thisGuy = getat(myGroup, i)
  66.       set hisType = getType(thisGuy)
  67.       if hisType = "knob" then
  68.         mouseEnter thisGuy --hilite the knob when rolled over a category
  69.       end if
  70.     end repeat
  71.   end if
  72.   -- hilite a selected category when rolled over it, if a subcategory menu is open
  73.   if catEnabled then 
  74.     set the member of sprite mySprite = member myRoller
  75.     puppetsound 3,"subrollOldOld"
  76.   end if
  77.   
  78.   
  79. end
  80.  
  81.  
  82. on mouseLeave me
  83.   if not selected then
  84.     set the member of sprite mySprite = member myNormal
  85.   else
  86.     repeat with i = 1 to count(myGroup)
  87.       set thisGuy = getat(myGroup, i)
  88.       set hisType = getType(thisGuy)
  89.       if hisType = "knob" then
  90.         mouseLeave thisGuy --get rid of a knob hilite when rolled off a category
  91.       end if
  92.     end repeat
  93.   end if
  94.   --  selected category returns to it's previous state 
  95.   --  when rolled off it, if a subcategory menu is open
  96.   if catEnabled then
  97.     set the member of sprite mySprite = member myHilite
  98.   end if
  99. end
  100.  
  101.  
  102.  
  103.  
  104. on mouseUp me
  105.   global  comefromQTVR
  106.   --  Reset global variable "comefromQTVR" which controls visibility of the "return to aircraft" button in cabin details section
  107.   set  comefromQTVR = FALSE
  108.   set the visible of sprite 110 = TRUE
  109.   
  110.   if not selected or catEnabled then
  111.     if catEnabled then set shouldHide = TRUE
  112.     set lastSub = void
  113.     IWasSelected lastSelected, me
  114.     set the member of sprite mySprite = member myHilite
  115.     repeat with i = 1 to count(myGroup)
  116.       set teamMate = getat(myGroup, i)
  117.       set type = getType(teamMate)
  118.       
  119.       if type = "category" then
  120.         nothing
  121.       else 
  122.         if type = "knob" then
  123.           --          Category is selected for the first time,
  124.           --          so when subcategory menu opens, no subcategory should be hilited
  125.           deleteSub(teamMate)
  126.         else if type = "subCategory" then
  127.           --Make sure to hilite subcategory item which takes you to the same frame
  128.           if myFrame = getFrame(teamMate) then
  129.             reset teamMate
  130.             setSubCat me, teamMate
  131.           end if
  132.         end if
  133.         
  134.         if  not selected then
  135.           showYourSelf teamMate
  136.         end if
  137.         
  138.         if shouldHide then
  139.           hideYourSelf teamMate  
  140.         end if
  141.         
  142.       end if
  143.     end repeat
  144.     
  145.     set catEnabled = 0
  146.     set selected = 1
  147.     
  148.     set thisMovie = the movie
  149.     if thisMovie = "bjs.dir" or thisMovie = "cs.dir" or thisMovie = "bombinc.dir" then
  150.       nothing
  151.     else
  152.       ResetTour
  153.       closeMovie
  154.     end if
  155.     
  156.     puppetsprite 22, false
  157.     clearpups
  158.     sendAllSprites(#qtvrPuppetOff, myFrame)
  159.     go to frame myFrame
  160.     puppetsound 3, "mouse5"
  161.     sound stop(1)
  162.     sound stop(2)
  163.   else
  164.     --reopen subcategory menu, which was folded up by knob
  165.     repeat with i = 1 to count(myGroup)
  166.       set teamMate = getat(myGroup, i)
  167.       showYourSelf teamMate
  168.     end repeat
  169.     if not voidP(lastSub) then
  170.       --hilite selected subcategory
  171.       reset lastSub
  172.     end if
  173.     setCatEnable me, TRUE
  174.   end if
  175. end
  176.  
  177.  
  178. on setSubCat me, theSub
  179.   set lastSub = theSub  
  180. end
  181.  
  182. on deselect me
  183.   repeat with i = 1 to count(myGroup)
  184.     set teamMate = getat(myGroup, i)
  185.     disable teamMate
  186.   end repeat
  187. end
  188.  
  189. on disable me
  190.   set selected = 0
  191.   set catEnabled = 0
  192.   set the member of sprite mySprite = member myNormal
  193. end
  194.  
  195. on hideYourSelf me
  196.   set selected = 1
  197.   set the member of sprite mySprite = member myHilite
  198. end
  199.  
  200. on showYourSelf me
  201.   set selected = 1
  202.   set the member of sprite mySprite = member myHilite
  203. end
  204.  
  205. on setCatEnable me, TrueOrFalse
  206.   if marker(0) <> label(myFrame) then
  207.     set catEnabled = TrueOrFalse
  208.   end if
  209. end
  210.  
  211.  
  212.  
  213. -- not called in this application, but necessary to call on menuController, if the "behaviour line" is ever broken in any movie
  214. on endPuppeting me
  215.   puppetSprite mySprite, false
  216. end
  217.  
  218.  
  219.